'use strict';

const cluster = require('cluster');
const app = require('./app');

if (cluster.isMaster) {
    cluster.on('fork', function(worker) {
        console.log('worker:' + worker.process.pid + '*****Start*****');
    });

    cluster.on('exit', function(worker, code, assign) {
        console.log('worker:' + worker.process.pid + '!!!!!Dead!!!!!');
        cluster.fork();
    });

    cluster.fork();
} else {
    app.begin();
}